<?php

/**
 * Класс описания микроданных для поисковиков
 * Тип AggregateRating
 *
 * @author xStream
 * @version 1.0.0
 */

class Microdata_Rating extends Microdata_Base {
	const google_type = 'AggregateRating';
	
	public function __construct(BaseHotel $objHotel = null) {
		if(!$objHotel) return;
	
		$arrHotel =& $objHotel->tableFields;
		$review_nr = Service_Function::getValue(0, $arrHotel, 'review_nr');
		$review_score = number_format(Service_Function::getValue(0, $arrHotel, 'review_score'), 1);
		
		if($review_nr < 3) return;
		
		$this->reviewCount = $review_nr; 
		$this->ratingValue = $review_score;
		$this->bestRating = 10;
		
		$this->valid = true;
	}
}